package info.sean.config;

import info.sean.interceptor.MyInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 自定义配置类，将自定义拦截器交由springmvc容器管理
 */
public class MyMvcConfig  implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //将自定义拦截器交由springmvc容器管理  addPathPatterns:配置拦截器拦截路径规则
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**");
    }
}
